package cn.iocoder.yudao.framework.business.basic.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 时间范围类型的枚举
 *
 * @author owen
 */
@RequiredArgsConstructor
@Getter
public enum TimeRangeTypeEnum implements EnumValuable {

    DAY(1, "天", "今日"),
    WEEK(7, "周", "近一周"),
    MONTH_HALF(15, "半月", "近半月"),
    MONTH(30, "月", "近一月"),
    QUARTER(90, "季", "近一季"),
    YEAR_HALF(180, "半年", "近半年"),
    YEAR(365, "年", "近一年"),
    ;

    private final Integer value;
    private final String name;
    private final String desc;

    public static TimeRangeTypeEnum valueOf(Integer value) {
        for (TimeRangeTypeEnum item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return WEEK;
    }

}
